package com.eshin.configuration;

import com.eshin.autotest.bean.OrderBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;

import javax.annotation.PostConstruct;

/**
 * @author Eshin
 * @title: HelloConfiguration
 * @projectName pay
 * @date 2019/5/2816:59
 */

@Configuration
public class HelloConfiguration {

    @PostConstruct
    public void init(){
        System.out.println("HelloConfiguration init...");
    }

    @Bean
    @Scope(value = "singleton",proxyMode = ScopedProxyMode.TARGET_CLASS)
    public OrderBean orderBean1(){
        System.out.println("create default orderbean in HelloConfiguration");
        return new OrderBean();
    }
    @Configuration
    class HelloConfigurationInner1{
        @PostConstruct
        public void init(){
            System.out.println("HelloConfigurationInner1 init...");
        }
        @Bean
        public String getStr1(){
            System.out.println("helloTest in HelloConfigurationInner1");
            return "helloTest";
        }
    }

    @Configuration
    static class HelloConfigurationInner10{
        @PostConstruct
        public void init(){
            System.out.println("HelloConfigurationInner10 init...");
        }
        @Bean
        public String getStr10(){
            System.out.println("helloTest in HelloConfigurationInner10");
            return "helloTest";
        }
    }
}
